package com.lws.hellojms.module.jms.controller;

import com.lws.hellojms.module.jms.service.JMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2016/3/14.
 */
@Controller
@RequestMapping(value = "/jms.do")
public class JMSController {

    @Autowired
    private JMSService jmsService;

    @ResponseBody
    @RequestMapping(params = "method=sendMessage")
    public Integer sendMessage(String message) {
        jmsService.sendMessage("MyQueue", message);
        return 1;
    }

    @ResponseBody
    @RequestMapping(params = "method=publishTopic")
    public Integer publishTopic(String message) {
        jmsService.publishTopic("MyTopic", message);
        return 1;
    }

}
